import 'package:flutter_deer/generated/json/base/json_convert_content.dart';
import 'package:flutter_deer/database/beans/get_config_guns_entity.dart';
import 'package:common_utils/common_utils.dart';

import 'package:flutter_deer/util/input_formatter/mny_format.dart';


GetConfigGunsEntity $GetConfigGunsEntityFromJson(Map<String, dynamic> json) {
  final GetConfigGunsEntity getConfigGunsEntity = GetConfigGunsEntity();
  final String? businessCode = jsonConvert.convert<String>(json['businessCode']);
  if (businessCode != null) {
    getConfigGunsEntity.businessCode = businessCode;
  }
  final String? categoryCode = jsonConvert.convert<String>(json['categoryCode']);
  if (categoryCode != null) {
    getConfigGunsEntity.categoryCode = categoryCode;
  }
  final String? categoryId = jsonConvert.convert<String>(json['categoryId']);
  if (categoryId != null) {
    getConfigGunsEntity.categoryId = categoryId;
  }
  final List<String>? categoryIds = (json['categoryIds'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (categoryIds != null) {
    getConfigGunsEntity.categoryIds = categoryIds;
  }
  final String? envLevel = jsonConvert.convert<String>(json['envLevel']);
  if (envLevel != null) {
    getConfigGunsEntity.envLevel = envLevel;
  }
  final String? envLevelName = jsonConvert.convert<String>(json['envLevelName']);
  if (envLevelName != null) {
    getConfigGunsEntity.envLevelName = envLevelName;
  }
  final String? goodsShortName = jsonConvert.convert<String>(json['goodsShortName']);
  if (goodsShortName != null) {
    getConfigGunsEntity.goodsShortName = goodsShortName;
  }
  final String? goodsSkuId = jsonConvert.convert<String>(json['goodsSkuId']);
  if (goodsSkuId != null) {
    getConfigGunsEntity.goodsSkuId = goodsSkuId;
  }
  final String? goodsSkuName = jsonConvert.convert<String>(json['goodsSkuName']);
  if (goodsSkuName != null) {
    getConfigGunsEntity.goodsSkuName = goodsSkuName;
  }
  final String? goodsSkuPrice = jsonConvert.convert<String>(json['goodsSkuPrice']);
  if (goodsSkuPrice != null) {
    getConfigGunsEntity.goodsSkuPrice = goodsSkuPrice;
  }
  final int? scanCode = jsonConvert.convert<int>(json['scanCode']);
  if (scanCode != null) {
    getConfigGunsEntity.scanCode = scanCode;
  }
  final List<ShelfBean>? shelfList = (json['shelfList'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<ShelfBean>(e) as ShelfBean).toList();
  if (shelfList != null) {
    getConfigGunsEntity.shelfList = shelfList;
  }
  final String? standard = jsonConvert.convert<String>(json['standard']);
  if (standard != null) {
    getConfigGunsEntity.standard = standard;
  }
  final String? standardName = jsonConvert.convert<String>(json['standardName']);
  if (standardName != null) {
    getConfigGunsEntity.standardName = standardName;
  }
  final String? unit = jsonConvert.convert<String>(json['unit']);
  if (unit != null) {
    getConfigGunsEntity.unit = unit;
  }
  final String? unitName = jsonConvert.convert<String>(json['unitName']);
  if (unitName != null) {
    getConfigGunsEntity.unitName = unitName;
  }
  return getConfigGunsEntity;
}

Map<String, dynamic> $GetConfigGunsEntityToJson(GetConfigGunsEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['businessCode'] = entity.businessCode;
  data['categoryCode'] = entity.categoryCode;
  data['categoryId'] = entity.categoryId;
  data['categoryIds'] = entity.categoryIds;
  data['envLevel'] = entity.envLevel;
  data['envLevelName'] = entity.envLevelName;
  data['goodsShortName'] = entity.goodsShortName;
  data['goodsSkuId'] = entity.goodsSkuId;
  data['goodsSkuName'] = entity.goodsSkuName;
  data['goodsSkuPrice'] = entity.goodsSkuPrice;
  data['scanCode'] = entity.scanCode;
  data['shelfList'] = entity.shelfList?.map((v) => v.toJson()).toList();
  data['standard'] = entity.standard;
  data['standardName'] = entity.standardName;
  data['unit'] = entity.unit;
  data['unitName'] = entity.unitName;
  return data;
}

extension GetConfigGunsEntityExtension on GetConfigGunsEntity {
  GetConfigGunsEntity copyWith({
    String? businessCode,
    String? categoryCode,
    String? categoryId,
    List<String>? categoryIds,
    String? envLevel,
    String? envLevelName,
    String? goodsShortName,
    String? goodsSkuId,
    String? goodsSkuName,
    String? goodsSkuPrice,
    int? scanCode,
    List<ShelfBean>? shelfList,
    String? standard,
    String? standardName,
    String? unit,
    String? unitName,
  }) {
    return GetConfigGunsEntity()
      ..businessCode = businessCode ?? this.businessCode
      ..categoryCode = categoryCode ?? this.categoryCode
      ..categoryId = categoryId ?? this.categoryId
      ..categoryIds = categoryIds ?? this.categoryIds
      ..envLevel = envLevel ?? this.envLevel
      ..envLevelName = envLevelName ?? this.envLevelName
      ..goodsShortName = goodsShortName ?? this.goodsShortName
      ..goodsSkuId = goodsSkuId ?? this.goodsSkuId
      ..goodsSkuName = goodsSkuName ?? this.goodsSkuName
      ..goodsSkuPrice = goodsSkuPrice ?? this.goodsSkuPrice
      ..scanCode = scanCode ?? this.scanCode
      ..shelfList = shelfList ?? this.shelfList
      ..standard = standard ?? this.standard
      ..standardName = standardName ?? this.standardName
      ..unit = unit ?? this.unit
      ..unitName = unitName ?? this.unitName;
  }
}

ShelfBean $ShelfBeanFromJson(Map<String, dynamic> json) {
  final ShelfBean shelfBean = ShelfBean();
  final String? goodsSkuId = jsonConvert.convert<String>(json['goodsSkuId']);
  if (goodsSkuId != null) {
    shelfBean.goodsSkuId = goodsSkuId;
  }
  final String? shelfId = jsonConvert.convert<String>(json['shelfId']);
  if (shelfId != null) {
    shelfBean.shelfId = shelfId;
  }
  final String? shelfName = jsonConvert.convert<String>(json['shelfName']);
  if (shelfName != null) {
    shelfBean.shelfName = shelfName;
  }
  final int? shelfNo = jsonConvert.convert<int>(json['shelfNo']);
  if (shelfNo != null) {
    shelfBean.shelfNo = shelfNo;
  }
  final String? goodsShortName = jsonConvert.convert<String>(json['goodsShortName']);
  if (goodsShortName != null) {
    shelfBean.goodsShortName = goodsShortName;
  }
  final String? goodsSkuPrice = jsonConvert.convert<String>(json['goodsSkuPrice']);
  if (goodsSkuPrice != null) {
    shelfBean.goodsSkuPrice = goodsSkuPrice;
  }
  final String? goodsSkuName = jsonConvert.convert<String>(json['goodsSkuName']);
  if (goodsSkuName != null) {
    shelfBean.goodsSkuName = goodsSkuName;
  }
  final String? categoryId = jsonConvert.convert<String>(json['categoryId']);
  if (categoryId != null) {
    shelfBean.categoryId = categoryId;
  }
  final String? unitName = jsonConvert.convert<String>(json['unitName']);
  if (unitName != null) {
    shelfBean.unitName = unitName;
  }
  final bool? choose = jsonConvert.convert<bool>(json['choose']);
  if (choose != null) {
    shelfBean.choose = choose;
  }
  final int? orderCount = jsonConvert.convert<int>(json['orderCount']);
  if (orderCount != null) {
    shelfBean.orderCount = orderCount;
  }
  return shelfBean;
}

Map<String, dynamic> $ShelfBeanToJson(ShelfBean entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['goodsSkuId'] = entity.goodsSkuId;
  data['shelfId'] = entity.shelfId;
  data['shelfName'] = entity.shelfName;
  data['shelfNo'] = entity.shelfNo;
  data['goodsShortName'] = entity.goodsShortName;
  data['goodsSkuPrice'] = entity.goodsSkuPrice;
  data['goodsSkuName'] = entity.goodsSkuName;
  data['categoryId'] = entity.categoryId;
  data['unitName'] = entity.unitName;
  data['choose'] = entity.choose;
  data['orderCount'] = entity.orderCount;
  return data;
}

extension ShelfBeanExtension on ShelfBean {
  ShelfBean copyWith({
    String? goodsSkuId,
    String? shelfId,
    String? shelfName,
    int? shelfNo,
    String? goodsShortName,
    String? goodsSkuPrice,
    String? goodsSkuName,
    String? categoryId,
    String? unitName,
    bool? choose,
    int? orderCount,
  }) {
    return ShelfBean()
      ..goodsSkuId = goodsSkuId ?? this.goodsSkuId
      ..shelfId = shelfId ?? this.shelfId
      ..shelfName = shelfName ?? this.shelfName
      ..shelfNo = shelfNo ?? this.shelfNo
      ..goodsShortName = goodsShortName ?? this.goodsShortName
      ..goodsSkuPrice = goodsSkuPrice ?? this.goodsSkuPrice
      ..goodsSkuName = goodsSkuName ?? this.goodsSkuName
      ..categoryId = categoryId ?? this.categoryId
      ..unitName = unitName ?? this.unitName
      ..choose = choose ?? this.choose
      ..orderCount = orderCount ?? this.orderCount;
  }
}